package udpInvoker.test;

import udpInvoker.main.lib.Invoker;
import udpInvoker.main.lib.TopicSubscriber;

/**
 * Created by IntelliJ IDEA.
 * User: esr
 * Date: 21.nov.2008
 * Time: 12:44:21
 * Copyright 2008  Espen Skjervold, FFI
 */
public class PublisherTester implements TopicSubscriber {


    public PublisherTester() {

        Invoker invoker = new Invoker();
        invoker.subscribe(this, "news");


        invoker.publish("news", "This is a piece of news!");

        try {
            Thread.sleep(2000);
        } catch (InterruptedException e) {
            e.printStackTrace();  //To change body of catch statement use File | Settings | File Templates.
        }


         invoker.publish("news", "...and this is another piece of news!");

    }


    public static void main(String[] args) {

        new PublisherTester();
    }

    public void deliverMessage(String topic, Object object) {
        System.out.println("I got news! : " + object);
    }
}
